import { nFormatter } from '@/utils/nFormatter'

export default {
  backgroundColor: '#1c213e',
  title: {
    text: '操作提示:',
    subtext: '选中点后 a:向左移动点 d:向右移动点 k:开始点 j:结束点 q:清除 b:保存',
    left: 'center'
  },
  tooltip: {
    appendToBody: true,
    formatter: function(val = {}) {
      const { data = {} } = val
      const { hour, value } = data
      return `${hour}:00<br>抄表读数:${value}`
    }
  },
  xAxis: {
    name: '时间',
    type: 'category',
    nameTextStyle: {
      color: '#fff'
    },
    nameGap: 25,
    nameLocation: 'center',
    splitLine: {
      lineStyle: {
        type: 'dashed'
      }
    }
  },
  yAxis: {
    name: '读数',
    type: 'value',
    scale: true,
    nameTextStyle: {
      color: '#fff'
    },
    splitLine: {
      lineStyle: {
        type: 'dashed'
      }
    },
    axisLabel: {
      formatter: function(val) {
        return nFormatter(val)
      }
    }
  },
  series: [
    {
      type: 'line',
      symbolSize: 8
    }
  ],
  grid: {
    top: '20%',
    left: '5%',
    right: '5%',
    bottom: '15%'
  }
}
